package com.easychat.entity.dto;

import com.easychat.utils.StringTools;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author: yudaxian
 * @Description: TODO
 * @DateTime: 2024/8/21 15:38
 **/
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MessageSendDTO<T> implements Serializable {
    private static final long serialVersionUID = -5582199774907519799L;

    private Long messageId;

    private String sessionId;

    private String sendUserId;

    private String sendUserNickName;

    private String contactId;

    private String contactName;

    private String messageContent;

    private String lastMessage;

    private Integer messageType;

    private Long sendTime;

    private Integer contactType;

    // 扩展信息
    private T extendData;

    private Integer memberCount;

    // 消息状态  0：发送中，1：已发送，对于文件是异步上传用状态处理
    private Integer status;

    public String getLastMessage() {
        if (StringTools.isEmpty(lastMessage)) {
            return messageContent;
        }
        return lastMessage;
    }
}
